package d1_create_thread;
/**
 * 2024/6/22 让子类继承Thread类
 */
public class MyThread extends Thread{
    public MyThread (String name){
        super(name); //为当前线程设置名字
    }

    public MyThread(String a, Object c, Object b) {

        super();

    }


    //2.必须重写Thread类的run方法

    @Override
    public void run() {
        //描述线程的执行任务
        Thread T = Thread.currentThread();
        for (int i = 1; i <5 ; i++) {
            System.out.println(T.getName()+"子线程MyThread输出："+i);
        }
    }
}
